//
//  HYYStatusBottomView.swift
//  Hyy9Weibo
//
//  Created by Air on 16/4/6.
//  Copyright © 2016年 hyy. All rights reserved.
//

import UIKit

class HYYStatusBottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        prepareUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func prepareUI(){
//        backgroundColor=UIColor.random()
        //添加子控件
        addSubview(forwardButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(separatorViewFirst)
        addSubview(separatorViewSecond)
        //添加约束
        //三个按钮平铺
        //转发
        forwardButton.snp_makeConstraints { (make) in
            make.leading.top.bottom.equalTo(self)
            
        }
        //评论按钮
        commentButton.snp_makeConstraints { (make) in
            make.leading.equalTo(forwardButton.snp_trailing)
            make.top.bottom.equalTo(self)
            //宽度
            make.width.equalTo(forwardButton)
        }
        //赞
        likeButton.snp_makeConstraints { (make) in
            make.leading.equalTo(commentButton.snp_trailing)
            make.top.trailing.bottom.equalTo(self)
            //宽度
            make.width.equalTo(forwardButton)
        }
        //分割线1
        separatorViewFirst.snp_makeConstraints { (make) in
            make.centerX.equalTo(forwardButton.snp_trailing)
            make.centerY.equalTo(forwardButton)
        }
        
        //分割线2
        separatorViewSecond.snp_makeConstraints { (make) in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
    }
    
    //MARK: - 懒加载
    //转发
    private lazy var forwardButton:UIButton = UIButton(title: "转发", imageName: "timeline_icon_retweet", bkgImageName: "timeline_card_bottom_background", textColor: UIColor.lightGrayColor(), textFont: 9)
    //评论
    private lazy var commentButton:UIButton = UIButton(title: "评论", imageName: "timeline_icon_comment", bkgImageName: "timeline_card_bottom_background", textColor: UIColor.lightGrayColor(), textFont: 9)
    //点赞,使用默认参数
    private lazy var likeButton:UIButton = UIButton(title: "赞", imageName: "timeline_icon_unlike")
    
    //分割线1
    private lazy var separatorViewFirst:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    //分割线2
    private lazy var separatorViewSecond:UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
//    private lazy var forwardButton: UIButton = {
//        let button = UIButton()
//        //设置
//        button.setBackgroundImage(UIImage(named:"timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named:"timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        
//        button.setImage(UIImage(named:"timeline_icon_retweet"), forState: UIControlState.Normal)
//        button.setTitle("转发", forState: UIControlState.Normal)
//        button.setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
//        button.titleLabel?.font = UIFont.systemFontOfSize(9)
//        
//        return button
//    }()

}
